It may sometimes be necessary to take additional actions when a study is removed (closed) from a chart; like saving studies in an external database for retrieval at a later time.
To export or import studies, the following methods can be used:
exportLayout();
importLayout();
Adding an injection API append to 'panelClose' for panel studies, and 'removeOverlay' for overlay studies should allow you to include a call to your database every time any panel is removed, regardless of type.
It is also possible get a callback from the chart whenever the user changes the layout in any way as long as changeCallback
has a function registered.
For instance:
stxx.changeCallback=function(stxx, change){ if(change=="layout") saveLayout(); if(change=="vector") saveDrawings(); }
"layout" will occur whenever the user adds, deletes or resizes a panel, changes chartType, etc.
"vector" will occur whenever a user adds,edits or removes a drawing.